﻿using Startup.Base.Resources;
using Startup.DataContract.Basic;

namespace Startup.DataContract.String
{
	public class MaleNameContract : DataContractBase<string>
	{
		private static bool _initialized;
		private static string[] _names;

		public override object Generate()
		{
			if (!_initialized)
				Initialize();

			int index = _random.Next(0, _names.Length - 1);
			return '\"' + _names[index] + '\"';
		}

		private void Initialize()
		{
			AssemblyResourceReader reader = new AssemblyResourceReader(GetType().Assembly);
			_names = reader.ReadAllLinesFrom("Startup.DataContract.String.Resources.MaleNames.txt");

			_initialized = true;
		}

		public override string ToString()
		{
			return "Male Name";
		}
	}
}
